import request from '@/utils/request'

// 首页轮播图
export const swiper = function () {
  return request.get('/home/swiper')
}

// 租房小组
export const groups = function () {
  return request.get('/home/groups')
}

// 根据条件查询房屋
export const inquireHouses = function (params) {
  return request.get('/houses', { params })
}

// 查询房屋具体信息
export const information = function (id) {
  return request.get('/houses/' + id)
}

// 查看收藏列表
export const viewFavorites = function () {
  return request.get('/user/favorites')
}

// 添加收藏
export const addFavorite = function (id) {
  return request.post('/user/favorites/' + id)
}

// 删除收藏
export const delFavorite = function (id) {
  return request.delete('/user/favorites/' + id)
}

// 获取用户的资料信息
export const userProfile = function () {
  return request.get('/user')
}

// 发布房源
export const publishAvailability = function (body) {
  return request.post('/user/houses', body)
}

// 查看已发布房源
export const reviewRelease = function () {
  return request.get('/user/houses')
}

// 获取城市列表数据
export const getCity = function (leven) {
  return request.get('/area/city?level=' + leven)
}

// 房屋图像上传
export const imageUpload = function (file) {
  return request.post('/houses/image', file)
}

// 房屋图像上传
export const condition = function (id) {
  return request.get('/houses/condition?id=' + id)
}

// 根据条件查询房屋
export const inquireHousing = function (id) {
  return request.get('/houses?id=' + id)
}

// 小区关键词查询
export const keywordQueries = function (params) {
  return request.get('/area/community', { params })
}

// 查询房源数据
export const listingInformation = function (id) {
  return request.get('/area/map?id=' + id)
}
